package czp.handlertest2;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;


public class HandlerTest extends Activity {
	private Handler handler = new Handler();
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //handler.post(r);
        Thread thread = new Thread(r);
        thread.start();
        System.out.println("activity --> " + Thread.currentThread().getId());
        System.out.println("activityName --> " + Thread.currentThread().getName());
    }
    
    Runnable r = new Runnable() {
		
		@Override
		public void run() {
			System.out.println("handler --> " + Thread.currentThread().getId());
			System.out.println("handlerName --> " + Thread.currentThread().getName());
			try {
				Thread.sleep(10000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	};
}
